package lib.self.network.provider.ok.request;

import lib.self.network.bean.NetworkListener;
import lib.self.network.bean.NetworkRequest;
import lib.self.network.bean.NetworkRequest.TNetworkMethod;
import lib.self.network.util.OkHttpUtils;
import lib.self.network.util.builder.OkHttpRequestBuilder;
import lib.self.network.util.builder.PostStringBuilder;

/**
 * description: 通过string 上传
 * author: Steven Xiao
 * date: 2017/6/7
 */
public class StringPostBuilder extends BaseBuilder {

    public StringPostBuilder(NetworkRequest request, Object tag, int id, NetworkListener listener) {
        super(request, tag, id, listener);
    }

    @Override
    protected OkHttpRequestBuilder initBuilder() {
        String url = request().url();
        PostStringBuilder builder = OkHttpUtils.postString().url(url);
        builder.mediaType(request().mediaType());
        builder.content(request().content());
        return builder;
    }

    @Override
    public TNetworkMethod method() {
        return TNetworkMethod.post_string;
    }
}
